#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
###
#
# Copyright (C) 2009 yed_ <yed (a) vanyli (o) net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#
###

import sys
from gettext import gettext as _

try:
  from pyfuploader.core import PyfuploadCore
except ImportError, inst:
  print inst.args
  print("Error during some Pyfupload import")
  sys.exit()


if __name__ == "__main__":
  (options, args) = PyfuploadCore.parse_params()
  if (options.interface is True):
    try:
      from gtk.gdk import threads_init, threads_enter, threads_leave
      from gtk import main as gtk_main
      from pyfuploader.pyfuploadgtk import PyfuploadGTK
    except ImportError:
      print("Error during some GTK import")
      sys.exit()

    threads_init()
    PyfuploadGTK()
    threads_enter()
    gtk_main()
    threads_leave()
  
  else:
    try:
      from pyfuploader.pyfuploadcli import PyfuploadCLI
    except ImportError:
      print("Error during pyfupload import")

    PyfuploadCLI(args)
